<template>
<div class="m-content">
  <h3>欢迎来到港港的博客</h3>
  <el-avatar :size="50" :src="avatar"></el-avatar>
  <div>{{username}}</div>

  <div class="maction">
    <span>主页</span>
    <el-divider direction="vertical"></el-divider>
    <span><router-link to="/blog/add">发表博客</router-link></span>
    <el-divider direction="vertical"></el-divider>
    <span>退出</span>
  </div>
</div>
</template>

<script>
export default {
  created() {
    if (sessionStorage.getItem("userInfo")!==null){
      this.username = JSON.parse(sessionStorage.getItem("userInfo")).username
      this.avatar = JSON.parse(sessionStorage.getItem("userInfo")).avatar
    }

  },
  name: "Header",
  data(){
    return{
      username:'请先登录',
      avatar:'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png'
    }
  },
  methods:{
    logout(){

    }
  }
}
</script>

<style scoped>
.m-content{
  max-width: 960px;
  margin: 0 auto;
  text-align: center;
}
.maction{

}
</style>